package org.benxiong.iplay.util;

import org.benxiong.iplay.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.widget.Toast;

public class ToastUtil {

	public static void toast(String msg) {
		Toast.makeText(GlobalVar.appContext, msg, Toast.LENGTH_LONG).show();
	}
	
	public static void toast(int msgId) {
		Toast.makeText(GlobalVar.appContext, msgId, Toast.LENGTH_LONG).show();
	}
	
	public static void showMessageOnExit(String msg, final Activity activity) {
		new AlertDialog.Builder(activity).setTitle(R.string.alert).setMessage(msg)
			.setPositiveButton(android.R.string.ok, new OnClickListener() {

				@Override
				public void onClick(DialogInterface dialog, int which) {
					activity.finish();
				}
				
			}).create().show();
	}
}
